package org.qdao.implement.oracle;

import org.qdao.DBConfig;
import org.qdao.DBEngineFactory;
import org.qdao.core.DBType;

/**
 * 
 * @author 譚元吉
 * @since 2010/02/06 11:01:16
 */
public class OracleDBEngine extends org.qdao.AbstractDBEngine {

	static {
		DBEngineFactory.register(new OracleDBEngine());
	}

	protected OracleDBEngine() {
	}

	
	public boolean support(DBConfig config) {
		for (String path : config.jarPath) {
			String t = path.toLowerCase();
			if (!t.endsWith(".jar") && !t.endsWith(".class")) {
				return false;
			}
		}
		if (isEmpty(config.driver)
				|| isEmpty(config.username)
				|| isEmpty(config.password)
				|| isEmpty(config.url)) {
			return false;
		}
		int type = DBType.getType(config.driver);
		if (type != DBType.DB_TYPE_ORACLE) {
			return false;
		}
		if (!DBType.supportUrl(type, config.url)) {
			return false;
		}
		return true;
	}

	private boolean isEmpty(String value) {
		if (value == null || value.trim().length() == 0) {
			return true;
		}
		return false;
	}

	public static void main(String[] args) {
		int a = 1;
	}




}
